Developer Documentation

QuickTime 4 API Documentation

QuickTime Streaming

| Previous | Chapter Contents | Chapter Top | Next |

Handling Packets Yourself

Your packet reassembler can be called when each packet is received. If you have not yet opened a stream handler and set its timescale, you will receive a RTPRssmGetTimeScaleFromPacket call for each received packet.

Once the stream handler's timescale is set, the default behavior for the base reassembler is to fill out an RTPRssmPacket struct for each incoming packet, then to add each packet to the current packet list. The base reassembler starts a new packet list when a packet's RTP marker bit is set, or the RTP timestamp changes, or if your reassembler has set the kRTPRssmEveryPacketAChunkFlag in RTPRssmSetCapabilities.

If you want to fill-out or modify the RTPRssmPacket struct for each packet yourself, because you use variable payload header lengths, for example, implement the RTPRssmAdjustPacketParams function.

EXTERN_API( ComponentResult )
RTPRssmAdjustPacketParams(
    RTPReassembler rtpr,
    RTPRssmPacket *inPacket,
    SInt32          inFlags) ;


The inPacket parameter points to the RTPRssmPacket struct for the current packet. This structure has already been filled-in by the base reassembler.

struct RTPRssmPacket {
    struct RTPRssmPacket *next;
    struct RTPRssmPacket *prev;
    QTSStreamBuffer *streamBuffer;
    Boolean paramsFilledIn;
    UInt8   pad[1];
    UInt16  sequenceNum;
    UInt32  transportHeaderLength;/* filled in by base*/
    UInt32  payloadHeaderLength;/* derived adjusts this */
    UInt32  dataLength;
    SHServerEditParameters serverEditParams;
    TimeValue64     timeStamp;  
        /* lower 32 bits is original rtp timestamp*/
    SInt32  chunkFlags;     /* these are or'd together*/
    SInt32  packetFlags;

};
typedef struct RTPRssmPacketRTPRssmPacket;


prev
The previous packet in the list; NULL if this is the first packet
streamBuffer
The stream buffer containing the packet data
Important: Do not modify the data in the stream buffer. For example, if you have to
flip bytes for endian differences between network byte order and the native byte order, copy the resulting data. Do not flip the bytes in place. Other components might have references to the same data.
paramsFilledIn
sequenceNum
The sequence number associated with the packet. Sequence numbers are unsigned 16 bit numbers and wrap around. e.g. 65535 is followed by 0, 1, 2, etc. Sequence numbers start at arbitrary numbers.
transportHeaderLength
The length of the rtp header. The payload specific part of the packet begins immediately after the transport header. Important - do not assume that the rtp header length is 12.
payloadHeaderLength
The length of the payload header. The payload header (if any) starts immediately after the rtp header. This number gets filled in by the base rssm by using the number passed into RTPRssmSetPayloadHeaderLength. It can also be modified by the derived rssm.
dataLength
The length of the payload data. This is usually the length of the packet minus transport header length minus payload header length. The base rssm will set the default value to that. The your rssm can modify the number.
serverEditParams
 
timeStamp
The 64 bit timestamp associated with the packet, in the stream timebase, not the movie timebase. The timestamp sent in the rtp header is 32 bits and wraps around. The 64 bit timestamp in this structure accounts for the wraparound. The lower 32 bits are exactly the timestamp sent in the rtp header. The upper 32 bits are the number of wraparounds.
chunkFlags
Flags that should be set in the chunk that is sent to the stream handler. The base rssm calculates the value that is set in the SHCHunkRecord structure by ORing all the chunk flags in the RTPRssmPacket list. Your rssm should fill in these flags as appropriate. Flags you could set: kSHChunkFlagSyncSample - set this flag if the chunk is a sync sample kSHChunkFlagDataLoss - set this flag if the chunk has data loss in it - e.g. there was data loss in the video frame and the rssm did partial recovery
packetFlags
The base rssm fills-in this value. Defined flags are: kRTPRssmPacketHasMarkerBitSet = 0x00000001, The base rssm fills in this value from the rtp header. kRTPRssmPacketHasServerEditFlag = 0x00010000, The derived rssm should set this flag to 1 if this packet has a server edit. You should also fill in the serverEditParams

© 1998 Apple Computer, Inc.

| Previous | Chapter Contents | Chapter Top | Next |